// $ANTLR 3.4 C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g 2012-10-25 15:30:50
package PL.practica6;

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class AnalizadorEjemploParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BLANCO", "DIGITO", "DIVIDIR", "MULTIPLICAR", "NUMERO", "PARENTESIS", "RESTA", "SEPARADOR", "SUMA"
    };

    public static final int EOF=-1;
    public static final int BLANCO=4;
    public static final int DIGITO=5;
    public static final int DIVIDIR=6;
    public static final int MULTIPLICAR=7;
    public static final int NUMERO=8;
    public static final int PARENTESIS=9;
    public static final int RESTA=10;
    public static final int SEPARADOR=11;
    public static final int SUMA=12;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public AnalizadorEjemploParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public AnalizadorEjemploParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return AnalizadorEjemploParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g"; }



    ArrayList <RecognitionException> errores = new ArrayList<RecognitionException>();

    public boolean listaVacia (){
        if (errores.isEmpty()){
          return true;
        }else
          return false;
    }

    public ArrayList getListaErrores(){return errores;}


    @Override
    public void reportError (RecognitionException e){
      System.out.println (getErrorMessage(e, getTokenNames()));
      errores.add(e);
    }




    // $ANTLR start "entrada"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:34:1: entrada : instrucciones ;
    public final void entrada() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:34:9: ( instrucciones )
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:34:11: instrucciones
            {
            pushFollow(FOLLOW_instrucciones_in_entrada48);
            instrucciones();

            state._fsp--;


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "entrada"



    // $ANTLR start "instrucciones"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:35:1: instrucciones : ( instruccion )* ;
    public final void instrucciones() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:35:15: ( ( instruccion )* )
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:35:17: ( instruccion )*
            {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:35:17: ( instruccion )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( ((LA1_0 >= NUMERO && LA1_0 <= PARENTESIS)) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:35:18: instruccion
            	    {
            	    pushFollow(FOLLOW_instruccion_in_instrucciones56);
            	    instruccion();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "instrucciones"



    // $ANTLR start "instruccion"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:36:1: instruccion : exp SEPARADOR ;
    public final void instruccion() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:36:13: ( exp SEPARADOR )
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:36:15: exp SEPARADOR
            {
            pushFollow(FOLLOW_exp_in_instruccion66);
            exp();

            state._fsp--;


            match(input,SEPARADOR,FOLLOW_SEPARADOR_in_instruccion68); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "instruccion"



    // $ANTLR start "exp"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:37:1: exp : exp_mult ( ( SUMA | RESTA ) exp_mult )* ;
    public final void exp() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:37:5: ( exp_mult ( ( SUMA | RESTA ) exp_mult )* )
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:37:7: exp_mult ( ( SUMA | RESTA ) exp_mult )*
            {
            pushFollow(FOLLOW_exp_mult_in_exp75);
            exp_mult();

            state._fsp--;


            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:37:16: ( ( SUMA | RESTA ) exp_mult )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==RESTA||LA2_0==SUMA) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:37:17: ( SUMA | RESTA ) exp_mult
            	    {
            	    if ( input.LA(1)==RESTA||input.LA(1)==SUMA ) {
            	        input.consume();
            	        state.errorRecovery=false;
            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        throw mse;
            	    }


            	    pushFollow(FOLLOW_exp_mult_in_exp84);
            	    exp_mult();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "exp"



    // $ANTLR start "exp_mult"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:38:1: exp_mult : exp_base ( ( MULTIPLICAR | DIVIDIR ) exp_base )* ;
    public final void exp_mult() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:38:10: ( exp_base ( ( MULTIPLICAR | DIVIDIR ) exp_base )* )
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:38:12: exp_base ( ( MULTIPLICAR | DIVIDIR ) exp_base )*
            {
            pushFollow(FOLLOW_exp_base_in_exp_mult94);
            exp_base();

            state._fsp--;


            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:38:21: ( ( MULTIPLICAR | DIVIDIR ) exp_base )*
            loop3:
            do {
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( ((LA3_0 >= DIVIDIR && LA3_0 <= MULTIPLICAR)) ) {
                    alt3=1;
                }


                switch (alt3) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:38:22: ( MULTIPLICAR | DIVIDIR ) exp_base
            	    {
            	    if ( (input.LA(1) >= DIVIDIR && input.LA(1) <= MULTIPLICAR) ) {
            	        input.consume();
            	        state.errorRecovery=false;
            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        throw mse;
            	    }


            	    pushFollow(FOLLOW_exp_base_in_exp_mult103);
            	    exp_base();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop3;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "exp_mult"



    // $ANTLR start "exp_base"
    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:39:1: exp_base : ( NUMERO | PARENTESIS exp PARENTESIS );
    public final void exp_base() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:39:10: ( NUMERO | PARENTESIS exp PARENTESIS )
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( (LA4_0==NUMERO) ) {
                alt4=1;
            }
            else if ( (LA4_0==PARENTESIS) ) {
                alt4=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;

            }
            switch (alt4) {
                case 1 :
                    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:39:12: NUMERO
                    {
                    match(input,NUMERO,FOLLOW_NUMERO_in_exp_base113); 

                    }
                    break;
                case 2 :
                    // C:\\Users\\Jose\\workspace\\practica6\\src\\main\\java\\PL\\practica6\\AnalizadorEjemploParser.g:39:21: PARENTESIS exp PARENTESIS
                    {
                    match(input,PARENTESIS,FOLLOW_PARENTESIS_in_exp_base117); 

                    pushFollow(FOLLOW_exp_in_exp_base119);
                    exp();

                    state._fsp--;


                    match(input,PARENTESIS,FOLLOW_PARENTESIS_in_exp_base121); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "exp_base"

    // Delegated rules


 

    public static final BitSet FOLLOW_instrucciones_in_entrada48 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_instruccion_in_instrucciones56 = new BitSet(new long[]{0x0000000000000302L});
    public static final BitSet FOLLOW_exp_in_instruccion66 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_SEPARADOR_in_instruccion68 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_exp_mult_in_exp75 = new BitSet(new long[]{0x0000000000001402L});
    public static final BitSet FOLLOW_set_in_exp78 = new BitSet(new long[]{0x0000000000000300L});
    public static final BitSet FOLLOW_exp_mult_in_exp84 = new BitSet(new long[]{0x0000000000001402L});
    public static final BitSet FOLLOW_exp_base_in_exp_mult94 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_set_in_exp_mult97 = new BitSet(new long[]{0x0000000000000300L});
    public static final BitSet FOLLOW_exp_base_in_exp_mult103 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_NUMERO_in_exp_base113 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PARENTESIS_in_exp_base117 = new BitSet(new long[]{0x0000000000000300L});
    public static final BitSet FOLLOW_exp_in_exp_base119 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_PARENTESIS_in_exp_base121 = new BitSet(new long[]{0x0000000000000002L});

}